<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://iosr11.ui.tags/studentInfo" prefix="g" %>


<h:form>
	<g:studentInfo student="#{studentBean.student}" />

	<h:dataTable value="#{studentBean.student.grades}" var="ocena"  headerClass="tableHeader" styleClass="dataTable" rowClasses="oddRow, evenRow">
		<h:column>
			<f:facet name="header">
				<h:outputText value="Data" />
			</f:facet>
				<h:outputText value="#{ocena.date}" rendered="#{not commons.editMode}" />
		</h:column>
		<h:column>
			<f:facet name="header">
				<h:outputText value="Prowadzacy" />
			</f:facet>
				<h:outputText value="#{ocena.teacher.name}" rendered="#{not commons.editMode}" />
		</h:column>
		<h:column>
			<f:facet name="header">
				<h:outputText value="Ocena" />
			</f:facet>
				<h:inputText  value="#{ocena.grade}" rendered="#{commons.editMode}" id="grade" required="true">
					<f:validator validatorId="iosr11.ui.validators.Grade" />
				</h:inputText>
				<h:outputText value="#{ocena.grade}" rendered="#{not commons.editMode}" />
				<h:message for="grade" styleClass="errorMsg" />
		</h:column>
		<h:column>
			<f:facet name="header">
				<h:outputText value="Punkty" />
			</f:facet>
				<h:inputText  value="#{ocena.points}" rendered="#{commons.editMode}" />
				<h:outputText value="#{ocena.points}" rendered="#{not commons.editMode}" />
				<h:message for="points" styleClass="errorMsg" />
		</h:column>
	</h:dataTable>
	<h:commandButton value="Zapisz" action="#{studentBean.updateStudent}" rendered="#{commons.editMode}" />
	<h:commandButton value="Dodaj ocene" action="nav_new_student_mark" />
</h:form>